﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ReporterEngine.Model
{
    public class InstanceNode : BaseInstanceNode
    {
        public string InstanceName { get; set; }
        public string TypeName { get; set; }

        List<InstanceCategory> _Categories;
        public List<InstanceCategory> Categories
        {
            get
            {
                if(_Categories == null)
                {
                    _Categories = new List<InstanceCategory>();

                    _Categories.Add(new InstanceCategory{ Node = this,CategoryName = "Properties", CategoryType = CategoryTypes.Properties});
                    _Categories.Add(new InstanceCategory { Node = this, CategoryName = "Referencies", CategoryType = CategoryTypes.Referencies });
                    _Categories.Add(new InstanceCategory { Node = this, CategoryName = "UsedBy", CategoryType = CategoryTypes.UsedBy });

                    if (this.Element.Element("members") != null)
                    {
                        _Categories.Add(new InstanceCategory
                                            {
                                                Node = this,
                                                CategoryName = "Members",
                                                CategoryType = CategoryTypes.Members
                                            });
                    }

                    _Categories.Add(new InstanceCategory
                                        {
                                            Node = this, 
                                            CategoryName = "Dimensions", 
                                            CategoryType = CategoryTypes.Dimensions
                                        });
                }

                return _Categories;
            }
        }
    }
}
